/*
 *  Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 *  This source code is licensed under the MIT license found in the LICENSE
 *  file in the root directory of this source tree.
 *
 */

/*
 *  THIS FILE IS AUTOGENERATED. DO NOT MODIFY IT; ALL CHANGES WILL BE LOST IN
 *  VAIN.
 *
 *  @generated
 */
#pragma once

#include <string>
#include <utility>

#include <mcrouter/lib/RouteHandleTraverser.h>

#include "mcrouter/lib/carbon/test/gen/BMessages.h"

namespace carbon {
namespace test {
namespace B {

template <class Route>
class BRouteHandle;

class BRouteHandleIf {
 public:
  template <class Route>
  using Impl = BRouteHandle<Route>;

  /**
   * Returns a string identifying this route handle instance
   */
  virtual std::string routeName() const = 0;

  virtual ~BRouteHandleIf() = default;

  virtual TestBReply route(const TestBRequest&) = 0;

virtual bool traverse(
    const TestBRequest&,
    const facebook::memcache::RouteHandleTraverser<BRouteHandleIf>&) const = 0;
};

template <class Route>
class BRouteHandle : public BRouteHandleIf {
 public:
  template <class... Args>
  explicit BRouteHandle(Args&&... args)
      : route_(std::forward<Args>(args)...) {}
  std::string routeName() const override final {
    return route_.routeName();
  }

  TestBReply route(const TestBRequest& request) override final {
    return route_.route(request);
  }

bool traverse(
    const TestBRequest& request,
    const facebook::memcache::RouteHandleTraverser<BRouteHandleIf>& traverser)
    const override final {
  return route_.traverse(request, traverser);
}

 private:
  Route route_;
};
} // namespace B
} // namespace test
} // namespace carbon
